//
//  MyDingDanDe_ViewController.m
//  OpenYooxi_IOS
//
//  Created by YeahYes on 15/3/18.
//  Copyright (c) 2015年 com.ivyvi.ee. All rights reserved.
//

#import "MyDingDanDe_ViewController.h"
#import "DingDanXiangQing_TableViewCell.h"

static NSString *identify = @"cell";

@interface MyDingDanDe_ViewController ()

@end

@implementation MyDingDanDe_ViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.hidesBottomBarWhenPushed = YES;
        
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的订单";
    
    
    //2.第二种创建方式
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(0, 0, 10, 20);
    [leftButton setImage:[UIImage imageNamed:@"2_03"]
                 forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(leftAction:)
          forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    
    _dingdantableview.dataSource = self;
    _dingdantableview.delegate = self;
    _dingdantableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    _dingdantableview.backgroundColor = [UIColor clearColor];
    //取消tableview右侧的滑动条
    _dingdantableview.showsVerticalScrollIndicator = NO;
    _dingdantableview.backgroundColor = UIColorFromRGB(0xF1F2F6);
    
    _beijingView.backgroundColor = UIColorFromRGB(0xF1F2F6);
    
    UINib *nib = [UINib nibWithNibName:@"DingDanXiangQing_TableViewCell" bundle:[NSBundle mainBundle]];
    [_dingdantableview registerNib:nib forCellReuseIdentifier:identify];
}


#pragma mark - UITableView delegate

//设置组头视图的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {

    return 16;
}

#pragma mark - UITableView delegate 设置单元格高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return 230;
}

//1.指定组的数量
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 6;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        DingDanXiangQing_TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify forIndexPath:indexPath];
        cell.backgroundColor = [UIColor whiteColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.layer.borderColor = UIColorFromRGB(0xE5E5E5).CGColor;
        cell.layer.borderWidth = 1;
        return cell;
}

#pragma mark - 自定义组的头视图
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    UIView *headView = [[UIView alloc] initWithFrame:CGRectZero];
    headView.backgroundColor = [UIColor clearColor];
    return headView;
}

#pragma mark - 取消掉UITableView的选中状态

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
}




- (void)leftAction:(UIButton *)button {
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
